package com.qiantu.api.entity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.JoinProperty;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Unique;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.qiantu.api.db.greendao.DaoSession;
import com.qiantu.api.db.greendao.DeviceBeanDao;
import com.qiantu.api.db.greendao.SourceHomepageBeanDao;
import com.qiantu.api.db.greendao.DaoSession;
import com.qiantu.api.db.greendao.DeviceBeanDao;
import com.qiantu.api.db.greendao.SourceHomepageBeanDao;

@Entity
public class SourceHomepageBean {
    @Id(autoincrement = true)
    private Long localId;
    @Unique
    private String serialNo;
    private String roomSerialNo;
    private String areaType;
    private String deviceSerialNo;
    private String areaShowType;
    private String isHomePage;
    @ToMany(joinProperties = {
            @JoinProperty(name = "deviceSerialNo", referencedName = "deviceSerialNo")
    })
    private List<DeviceBean> devices;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1274547192)
    private transient SourceHomepageBeanDao myDao;
    @Generated(hash = 1879277231)
    public SourceHomepageBean(Long localId, String serialNo, String roomSerialNo,
            String areaType, String deviceSerialNo, String areaShowType, String isHomePage) {
        this.localId = localId;
        this.serialNo = serialNo;
        this.roomSerialNo = roomSerialNo;
        this.areaType = areaType;
        this.deviceSerialNo = deviceSerialNo;
        this.areaShowType = areaShowType;
        this.isHomePage = isHomePage;
    }
    @Generated(hash = 966780873)
    public SourceHomepageBean() {
    }
    public Long getLocalId() {
        return this.localId;
    }
    public void setLocalId(Long localId) {
        this.localId = localId;
    }
    public String getSerialNo() {
        return this.serialNo;
    }
    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }
    public String getRoomSerialNo() {
        return this.roomSerialNo;
    }
    public void setRoomSerialNo(String roomSerialNo) {
        this.roomSerialNo = roomSerialNo;
    }
    public String getAreaType() {
        return this.areaType;
    }
    public void setAreaType(String areaType) {
        this.areaType = areaType;
    }
    public String getDeviceSerialNo() {
        return this.deviceSerialNo;
    }
    public void setDeviceSerialNo(String deviceSerialNo) {
        this.deviceSerialNo = deviceSerialNo;
    }
    public String getAreaShowType() {
        return this.areaShowType;
    }
    public void setAreaShowType(String areaShowType) {
        this.areaShowType = areaShowType;
    }
    public String getIsHomePage() {
        return this.isHomePage;
    }
    public void setIsHomePage(String isHomePage) {
        this.isHomePage = isHomePage;
    }
    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1005857985)
    public List<DeviceBean> getDevices() {
        if (devices == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            DeviceBeanDao targetDao = daoSession.getDeviceBeanDao();
            List<DeviceBean> devicesNew = targetDao
                    ._querySourceHomepageBean_Devices(deviceSerialNo);
            synchronized (this) {
                if (devices == null) {
                    devices = devicesNew;
                }
            }
        }
        return devices;
    }
    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1428662284)
    public synchronized void resetDevices() {
        devices = null;
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1054248645)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getSourceHomepageBeanDao() : null;
    }
    
}
